import { NextResponse } from "next/server";
import { getServerAuthSession } from "@/auth";
import { prisma } from "@/lib/prisma";
import { recommendPosts } from "@/lib/recommend";

export async function GET() {
  const session = await getServerAuthSession();
  const userId = (session as any)?.user?.id ?? null;
  const data = await recommendPosts(prisma as any, userId, 20);
  return NextResponse.json({ items: data });
}